package models

type EsGoods struct {
	GoodsID      string `json:"goods_id"`
	CategoryID   int32  `json:"category_id"`
	Name         string `json:"name"`
	GoodsDesc    string `json:"goods_desc"`
	Click        int32  `json:"click"`
	Score        int32  `json:"score"`
	ShopMinPrice int32  `json:"shop_min_price"`
	ShopMaxPrice int32  `json:"shop_max_price"`
	PackingMode  string `json:"packing_mode"`
	LeadTime     string `json:"lead_time"`
	DeliveryTime string `json:"delivery_time"`
	MainPicture  string `json:"main_picture"`

	IsNew int32 `json:"is_new"`
	ISHot int32 `json:"is_hot"`

	KeyWords      string   `json:"key_words"`
	FaveNum       int32    `json:"fave_num"`
	Color         string   `json:"color"`
	ProductLength int32    `json:"product_length"`
	ProductWidth  int32    `json:"product_width"`
	ProductHeight int32    `json:"product_height"`
	ProductWeight int32    `json:"product_weight"`
	Material      string   `json:"material"`
	Image         []string `json:"image"`
	Qty1          int32    `json:"qty_1"`
	Price1        int32    `json:"price_1"`
	Qty2          int32    `json:"qty_2"`
	Price2        int32    `json:"price_2"`
	Qty3          int32    `json:"qty_3"`
	Price3        int32    `json:"price_3"`
	Qty4          int32    `json:"qty_4"`
	Price4        int32    `json:"price_4"`
	Qty5          int32    `json:"qty_5"`
	Price5        int32    `json:"price_5"`
	Qty6          int32    `json:"qty_6"`
	Price6        int32    `json:"price_6"`
	Qty7          int32    `json:"qty_7"`
	Price7        int32    `json:"price_7"`
	Qty8          int32    `json:"qty_8"`
	Price8        int32    `json:"price_8"`

	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

func (e EsGoods) GetIndexName() string {
	return "goods"
}

func (e EsGoods) GetMapping() string {
	return `
{
	"settings": {
		"number_of_shards": 1,
		"number_of_replicas": 0,
		"analysis": {
			"analyzer": {
				"stop_analyzer": {
					"type": "stop",
					"stopwords": "_english_"
				}
			}
		}
	},
	"mappings": {
		"properties":{
			"goods_id": {
				"type": "keyword"
			},
			"category_id": {
				"type": "integer"
			},
			"name": {
				"type": "text",
				"analyzer": "stop_analyzer"
			},
			"goods_desc": {
				"type": "text",
				"analyzer": "stop_analyzer"
			},
			"click": {
				"type": "integer"
			},
			"score": {
				"type": "integer"
			},
			"shop_min_price": {
				"type": "integer"
			},
			"shop_max_price": {
				"type": "integer"
			},
			"packing_mode": {
				"type": "keyword"
			},
			"lead_time": {
				"type": "text"
			},
			"delivery_time": {
				"type": "text"
			},
			"main_picture": {
				"type": "keyword"
			},
			"is_new": {
				"type": "integer"
			},
			"is_hot": {
				"type": "integer"
			},
			"key_words": {
				"type": "text",
				"analyzer": "stop_analyzer"
			},
			"fave_num": {
				"type": "integer"
			},
			"color": {
				"type": "keyword"
			},
			"product_length": {
				"type": "integer"
			},
			"product_width": {
				"type": "integer"
			},
			"product_height": {
				"type": "integer"
			},
			"product_weight": {
				"type": "integer"
			},
			"material": {
				"type": "keyword"
			},
			"image": {
				"type": "keyword"
			},
			"qty_1": {
				"type": "integer"
			},
			"price_1": {
				"type": "integer"
			},
			"qty_2": {
				"type": "integer"
			},
			"price_2": {
				"type": "integer"
			},
			"qty_3": {
				"type": "integer"
			},
			"price_3": {
				"type": "integer"
			},
			"qty_4": {
				"type": "integer"
			},
			"price_4": {
				"type": "integer"
			},
			"qty_5": {
				"type": "integer"
			},
			"price_5": {
				"type": "integer"
			},
			"qty_6": {
				"type": "integer"
			},
			"price_6": {
				"type": "integer"
			},
			"qty_7": {
				"type": "integer"
			},
			"price_7": {
				"type": "integer"
			},
			"qty_8": {
				"type": "integer"
			},
			"price_8": {
				"type": "integer"
			},
			"created_at": {
				"type": "date",
				"format": "yyyy-MM-dd HH:mm:ss||strict_date_optional_time||epoch_millis"
			},
			"updated_at": {
				"type": "date",
				"format": "yyyy-MM-dd HH:mm:ss||strict_date_optional_time||epoch_millis"
			}
		}
	}
}
`
}
